import java.util.Scanner;

public class HJ13 {//句子逆序
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        String Str = in.nextLine();
        StringBuilder temple = new StringBuilder();
        StringBuilder target = new StringBuilder();
        for (int j = Str.length()-1 ; j >= 0 ; j --){//倒置整个字符串
            temple.append(Str.charAt(j));
        }
        int start = 0 ;//倒置字符串的起始位置
        for (int i = 0 ; i < temple.length(); i ++){//正序读取字符串，记录" "符号存在的位置
            if (temple.charAt(i) == ' '){
                for (int j = i-1 ; j >= start ; j --){//倒置两个空格间的字符串
                    target.append(temple.charAt(j));
                }
                target.append(' ');
                start = i+1 ;
            }else if (i == temple.length()-1){
                for (int j = i; j >= start ; j --){//倒置两个空格间的字符串
                    target.append(temple.charAt(j));
                }
            }
        }
        System.out.println(target);
    }
}
